home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 176-200 / scopedisk180 / arexxtutorial / usn / usno.doc < prev    next >
Text File  |  1995-03-19  |  4KB  |  98 lines

  1. Usno.rexx (c) 1989 Steve Poling.  Freely distributable to all, keep it
  2. that way.  Kudos, to Jeremy Farrance who provided critical sections of
  3. code to make usno.rexx work in all situations. 
  4.  
  5. Usno.rexx was written by Steve Poling as an excercize in AREXX
  6. programming.  The date of this release 1.0 28 aug 89.  You may not
  7. find this program terribly useful if:
  8.  
  9.  - You have no interest in AREXX
  10.  - You don't own Baud Bandit (it might be converted to VLT, idunno)
  11.  - You refuse to tolerate another program that does what AtomClock does.
  12.    (AtomClock is a Modula-2 program (I haven't seen source) that also calls
  13.    the Naval Observatory.  See section Usno vs AtomClock for more.)
  14.  
  15. Being something of an astronomy buff I was aware of the US Naval
  16. Observatory's (USNO) various contribution to amateur astronomy for us
  17. computerized folk.  One of the services of USNO is to distribute
  18. accurate time codes.  If you call 1(202)653-0351, a USNO computer will
  19. answer and it will send a series of pairs of lines of the form:
  20.  
  21.     jjjjj ddd hhmmss UTC 
  22.     *
  23.  
  24. The actual output is not Js, Xs, etc. but digits.  The meaning of those digits
  25. is as follows:
  26.     jjjjj stands for the 5 least significant digits of the Julian date.
  27.     ddd   stands for the number of days since Jan 1st of this year. 
  28.     hhmmss stands for the Hours Minutes Seconds of right now
  29. The UTC indicates that they aren't talking Washington DC
  30. clock-on-the-wall time.  The UTC is roughly the same as GMT or Zulu
  31. give or take a leap second or two, I think. 
  32.  
  33. Note that if the USNO changes their format, their phone number or
  34. their baud rate, this program will have to change.  
  35.  
  36. This is my first rexx program so please be gentle in criticism.
  37.  
  38. Many times I was confronted with problems, and the only solution I
  39. could find was an ugly, brute force solution.  I hope that some kind
  40. soul will view this code with compassion, and show me a better way to
  41. do some of these things.   (Jeremy was the first such benefactor.)  I
  42. will enumerate the problems and I will incorporate your suggestions in
  43. subsequent releases of Usno.rexx. 
  44.  
  45. - I never did get DIAL to work, I couldn't tell which BaudBandit commands
  46.   returned status codes or not.  Frustrating as heck.
  47. - I had a SEND command, but no way to GET chars directly from port as
  48.   I wanted.   Had to resort to a RAM file capture.  PULL didn't do
  49.   what I wanted.
  50.  
  51. Many thanks belong to Art Steinmetz who's program I studied while
  52. writing this one.  (I didn't have source, I saw how it ran.)  More
  53. thanks belong to Jeremy Farrance who offered helpful suggestions and
  54. then Jeremy took my pre-release code and improved it drastically.
  55. Finally thanks go to Jean Meeus who's book Astronomical Formulae for
  56. Calculators provided the algorithm for Julian to calendar date
  57. conversion. 
  58.  
  59. AtomClock VS Usno.rexx
  60. You are probably wondering how Usno.rexx fits into the eternal scheme
  61. of things.  Expecially since the problem is already, essentially
  62. solved.  I don't think of the two programs as being competitors.  Each
  63. serves a different purpose:
  64.  
  65. Usno - to teach ME rexx and program interfacing. PERIOD.  It sets the
  66.            the clock, too.  Maybe teach you something, too?
  67. AtomClock - to set the amigados system clock, and whatever else Art 
  68.     Steinmetz wanted from it.
  69.  
  70. Relative strengths:
  71.  
  72. AtomClock - Workbench support.  Critical variables are held in the
  73. tooltypes of the icon, where they can be easily modified.  This is a
  74. superior approach.  I'll bet AtomClock is more accurate and faster.
  75. AtomClock is compiled, to it takes less core, etc. 
  76.  
  77. Usno.rexx - has none of those things.  The USNO phone number, its baud
  78. rate, the modem control stuff are all hard-coded in the rexx source.
  79. I considered putting in stuff to read those params out of an icon
  80. file, but hey, the language is interpreted.  Everyone's got the
  81. source, people can read comments, they can change it themselves w/o
  82. too much hassle.  I just saved myself the programming to do all that
  83. stuff unrelated to the primary mission of USNO.REXX.  You'll note that
  84. unlike AtomClock, usno.rexx sets the date and year.
  85.  
  86. I leave as an excercize to the student: Modify USNO.REXX to set the
  87. system hardware clock after it sets AmigaDog's time. 
  88.  
  89. LAST WORD: (At last!)
  90.  
  91. I've also provided for your pleasure the programs Julian.rexx and
  92. DeJulian.rexx.  These programs do Julian date conversions in exactly
  93. the reverse of what you'd expect. 
  94.  
  95. Cheers, 
  96. Steve Poling, 28-Aug-1989, 
  97. 47767 241 013150 UTC
  98.